# -*- coding: utf-8 -*-
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#作者：cacho_37967865
#博客：https://blog.csdn.net/sinat_37967865
#文件：get_stock_N.py
#日期：2020-11-10
#备注：尾盘反包股（收盘价大于昨天最低价，最高价小于今天开盘价，跌幅小于昨天涨幅，昨天涨幅大于5%，量能小于昨天80%，热点人气股，并且当天大盘收绿）
CREATE TABLE `stock_N` (
  `N_date` varchar(10) NOT NULL COMMENT '跳空开始日',
  `stock_no` varchar(10) NOT NULL COMMENT '股票代码',
  `stock_name` varchar(10) DEFAULT NULL COMMENT '股票简称',
  `gap_price` float DEFAULT '0' COMMENT '跳空开始日最高价',
  `gap_is` varchar(2) DEFAULT '否' COMMENT '跳空缺口是否回补',
  `gap_is_price` float DEFAULT '0' COMMENT '回补缺口最低价',
  `gap_is_date` varchar(10) DEFAULT NULL COMMENT '回补缺口日期',
  `target_date` varchar(32) NOT NULL COMMENT '第7预计交易日期',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`stock_no`,`gap_date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='7天内跳空不补缺股票统计表';

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
from pycacho.cachobase.chinese_workday import get_trade_day
from pacong.stock.stock_config import db,cursor


# 创业板当天涨跌幅
def index_is(n_date):
    sql = 'select index_changeRate from stock_index where DATE_FORMAT(index_date,"%Y-%m-%d %k")=DATE_FORMAT({0},"%Y-%m-%d 14") and index_no="399006";'.format(n_date)
    cursor.execute(sql)
    results = cursor.fetchone()
    index_chg = results[0]
    print(index_chg)
    return index_chg

def n_stock():
    pass



if __name__ == '__main__':
    index_is(get_trade_day(0))


